import { ATeamCombat } from "GameLoop/WorldState/EntityManager/Entitys";
import { ETeamState } from "GameLoop/WorldState/EntityManager/Entitys/team";
import { BinaryDecision } from "framework/FSM/DecisionTree/Decision";
 

/**
 * 是否需要集结
*/
export class DecisionIsTeam4MoveActive <T extends IStateArg<ATeamCombat,ITask>> extends BinaryDecision<T>
{

    public testValue(arg:T): boolean
    {
        //arg.entity.log("info",`${arg.entity.GUID()}  移动目标!${JSON.stringify(arg.entity.moveTarget())}`);
        const state = arg.entity.getNodeMemory().teamState 
        if(state != ETeamState.Full && state != ETeamState.Absence)
        {
            return false;
        }
        if(!arg.entity.moveTarget())
        {
            return false;
        }
        if(!arg.entity.isTeamMoveReady)
        {
            return false;
        }
        for(const e of arg.entity.creeps)
        {
            if(!e.isBoostComplete())
            {
                return false;
            }
        }
        return true;
        // return true;
    }

    value: any;


    public setValue(val: any)
    {
        this.value = val;
    }
}

